//
//  TLCLockDemoApp.swift
//  TLCLockDemo
//
//  Created by run on 2024/7/6.
//

import SwiftUI
import TLCLock

@main
struct TLCLockDemoApp: App {
    @UIApplicationDelegateAdaptor var appDelegate: AppDelegate

    var body: some Scene {
        WindowGroup {
            MainView()
                .withToast()
        }
    }
}

final class AppDelegate: NSObject, UIApplicationDelegate {
    func application(
        _: UIApplication,
        didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]? = nil
    ) -> Bool {
        Log.initLog()
        Log.debug("didFinishLaunchingWithOptions")
        
        Log.debug("tlcSDKVersion: \(tlcSDKVersion)")
        /*
        TLCManager.setLogLevel(.debug) { message, logLevel in
            switch logLevel {
            case .debug:
                Log.debug(message)
            case .info:
                Log.info(message)
            case .warning:
                Log.warning(message)
            case .error:
                Log.error(message)
            }
        }
        
        // test
        let isValid = TLCManager.checkFeatureCode("E20F528D91823DD345EFF98841367F14")
        Log.info("isValid: \(isValid)")
        */

        return true
    }
}
